import {NestFactory} from "@nestjs/core";
import {AppModule} from './app.module'
import {LoggerInterceptor5,LoggerInterceptor6} from './interceptors/logger.interceptor';

const bootstrap = async ()=>{
    const app = await NestFactory.create(AppModule);
    app.useGlobalInterceptors(new LoggerInterceptor5())
    app.useGlobalInterceptors(new LoggerInterceptor6())
    await app.listen(8092)
}
bootstrap();

// 洋葱圈顺序，绑定的过滤器距离方法近最内层
// LoggerInterceptor5 Before...
// LoggerInterceptor6 Before...
// LoggerInterceptor4 Before...
// LoggerInterceptor3 Before...
// LoggerInterceptor2 Before...
// LoggerInterceptor Before...
// app.index...
// for(let k=0;k<3;k++)
//     for(let k=1;k<3;k++)
//         for(let k=2;k<3;k++)
// LoggerInterceptor After... 2ms
// LoggerInterceptor2 After... 2ms
// LoggerInterceptor3 After... 3ms
// LoggerInterceptor4 After... 4ms
// LoggerInterceptor6 After... 5ms
// LoggerInterceptor5 After... 5ms
